package com.foreveredu.propms.domain;

import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;

/**
 * Description:<br/>
 * 领域模型：账单类，代表房产每月应缴账单，包括每个房产应缴的物业费用总和<br/>
 * Date:<br/>
 * 2013/7/1<br/>
 * 
 * @author hushigang
 */

@Entity
@Table(name = "T_Bill")
public class Bill {

	private int id;// 自动编号
	private House house;// 房产
	private Set<ChargeRecord> records;// 收费记录
	private float amount;// 应收金额
	private float paidAmount;// 实收金额
	private int year;// 年份
	private int month;// 月份
	private int isPaid;// 是否已支付账单，1支付，0未支付
	private int isInvoiced;// 是否已开发票，1已开票，0未开票

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	@ManyToOne
	@JoinColumn(name = "house_id")
	public House getHouse() {
		return house;
	}

	public void setHouse(House house) {
		this.house = house;
	}

	@OneToMany(cascade=CascadeType.REMOVE, mappedBy = "bill")
	@OrderBy(value = "id ASC")
	public Set<ChargeRecord> getRecords() {
		return records;
	}

	public void setRecords(Set<ChargeRecord> records) {
		this.records = records;
	}

	@Column
	public int getYear() {
		return year;
	}

	public void setYear(int year) {
		this.year = year;
	}

	@Column
	public int getMonth() {
		return month;
	}

	public void setMonth(int month) {
		this.month = month;
	}

	@Column
	public float getAmount() {
		return amount;
	}

	public void setAmount(float amount) {
		this.amount = amount;
	}

	@Column
	public int getIsPaid() {
		return isPaid;
	}

	public void setIsPaid(int isPaid) {
		this.isPaid = isPaid;
	}

	@Column
	public int getIsInvoiced() {
		return isInvoiced;
	}

	public void setIsInvoiced(int isInvoiced) {
		this.isInvoiced = isInvoiced;
	}

	@Column
	public float getPaidAmount() {
		return paidAmount;
	}

	public void setPaidAmount(float paidAmount) {
		this.paidAmount = paidAmount;
	}
}
